import APIS from '../api';
import httpRequest from '../httpRequest';

// 题目数据的类型
export type QUESTIONTYPE = {
  error: null;
  data: {
    id: number;
    tags: {
      id: number;
      name: string;
      parent_tag: number;
    }[];
    created_by: {
      id: number;
      username: string;
      name: null;
      real_name: null;
    };
    template: object;
    _id: string;
    title: string;
    description: string;
    input_description: string;
    output_description: string;
    samples: {
      input: string;
      output: string;
    }[];
    hint: string;
    languages: [
      'C',
      'C++',
      'Golang',
      'Java',
      'JavaScript',
      'Python2',
      'Python3',
    ][number];
    create_time: string;
    last_update_time: string | null;
    time_limit: number;
    memory_limit: number;
    io_mode: {
      input: string;
      output: string;
      io_mode: string;
    };
    spj: boolean;
    spj_language: null;
    rule_type: string;
    difficulty: string;
    source: string;
    total_score: number;
    submission_number: number;
    accepted_number: number;
    statistic_info: {
      string: number;
    };
    share_submission: boolean;
    contest: null;
    my_status: number;
  };
};
// 获取题目详情
export const getQuestionDetail = (data: { problemId: string }) => {
  return httpRequest.get<QUESTIONTYPE>({
    url: APIS.questionDetail + data.problemId,
  });
};
